#include <reg52.h>
#include "delay12mhz.h"
#include "lcd1602.h"
#include "ds18b20.h"

unsigned int Temperature;

void Show_LCD1602();
void System_Init();

void main()
{
	System_Init();
	while(1)
	{
		Temperature = Get_Tmp();
		Show_LCD1602();
		delay1sec();
	}
}

void System_Init()
{
	LCD1602_Init();
	Temperature = Get_Tmp();
	delay1sec();
	delay1sec();
}

void Show_LCD1602()
{
	int i = 0;
	if(Temperature > 0 && Temperature < 100)
	{
		while(Temperature)
		{
			LCD1602_Write_Cmd(0x89 - i);
			LCD1602_Write_Data((Temperature % 10) + '0');
			Temperature = (Temperature / 10);
			i++;
		}
	}
}